usbcpower3 2.2.0
Loading...
Searching...
No Matches
USB-C Power 3 Click Driver

API for configuring and manipulating USB-C Power 3 Click driver. More...

Topics

 USB-C Power 3 Registers List
 List of registers of USB-C Power 3 Click driver.
 USB-C Power 3 Registers Settings
 Settings for registers of USB-C Power 3 Click driver.
 USB-C Power 3 MikroBUS Map
 MikroBUS pin mapping of USB-C Power 3 Click driver.

Functions

void usbcpower3_cfg_setup (usbcpower3_cfg_t *cfg)
 USB-C Power 3 configuration object setup function.
err_t usbcpower3_init (usbcpower3_t *ctx, usbcpower3_cfg_t *cfg)
 USB-C Power 3 initialization function.
err_t usbcpower3_ptn_write_reg_byte (usbcpower3_t *ctx, uint8_t reg, uint8_t data_in)
 USB-C Power 3 PTN write register byte function.
err_t usbcpower3_ptn_read_reg_byte (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out)
 USB-C Power 3 PTN read register byte function.
err_t usbcpower3_ptn_write_reg_word (usbcpower3_t *ctx, uint8_t reg, uint16_t data_in)
 USB-C Power 3 PTN write register word function.
err_t usbcpower3_ptn_read_reg_word (usbcpower3_t *ctx, uint8_t reg, uint16_t *data_out)
 USB-C Power 3 PTN read register word function.
err_t usbcpower3_ptn_write_reg_block (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 USB-C Power 3 PTN write register block function.
err_t usbcpower3_ptn_read_reg_block (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 USB-C Power 3 PTN read register block function.
err_t usbcpower3_act_write_reg (usbcpower3_t *ctx, uint8_t reg, uint8_t data_in)
 USB-C Power 3 ACT write register function.
err_t usbcpower3_act_read_reg (usbcpower3_t *ctx, uint8_t reg, uint8_t *data_out)
 USB-C Power 3 ACT read register function.
err_t usbcpower3_ptn_read_info (usbcpower3_t *ctx)
 USB-C Power 3 PTN read device information function.
void usbcpower3_enable_device (usbcpower3_t *ctx)
 USB-C Power 3 device enable function.
void usbcpower3_disable_device (usbcpower3_t *ctx)
 USB-C Power 3 device disable function.
void usbcpower3_restart_device (usbcpower3_t *ctx)
 USB-C Power 3 device restart function.
err_t usbcpower3_wait_tcpc_init (usbcpower3_t *ctx)
 USB-C Power 3 wait TCPC init function.
void usbcpower3_set_high_current (usbcpower3_t *ctx)
 USB-C Power 3 set high current function.
void usbcpower3_set_low_current (usbcpower3_t *ctx)
 USB-C Power 3 set low current function.
uint8_t usbcpower3_get_int_pin (usbcpower3_t *ctx)
 USB-C Power 3 get interrupt pin function.
uint8_t usbcpower3_get_fen_pin (usbcpower3_t *ctx)
 USB-C Power 3 get FEN pin function.

Detailed Description

API for configuring and manipulating USB-C Power 3 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ usbcpower3_act_read_reg()

err_t usbcpower3_act_read_reg ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t * data_out )

USB-C Power 3 ACT read register function.

This function reads one byte from the selected ACT buck-boost converter register over I2C.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the memory location where the read data will be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_act_write_reg()

err_t usbcpower3_act_write_reg ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t data_in )

USB-C Power 3 ACT write register function.

This function writes one byte to the selected ACT buck-boost converter register over I2C.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data byte to write.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_cfg_setup()

void usbcpower3_cfg_setup ( usbcpower3_cfg_t * cfg)

USB-C Power 3 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See usbcpower3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ usbcpower3_disable_device()

void usbcpower3_disable_device ( usbcpower3_t * ctx)

USB-C Power 3 device disable function.

This function disables the device by clearing the enable pin.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ usbcpower3_enable_device()

void usbcpower3_enable_device ( usbcpower3_t * ctx)

USB-C Power 3 device enable function.

This function enables the device by setting the enable pin.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ usbcpower3_get_fen_pin()

uint8_t usbcpower3_get_fen_pin ( usbcpower3_t * ctx)

USB-C Power 3 get FEN pin function.

This function reads the FEN pin state.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ usbcpower3_get_int_pin()

uint8_t usbcpower3_get_int_pin ( usbcpower3_t * ctx)

USB-C Power 3 get interrupt pin function.

This function reads the interrupt pin state.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ usbcpower3_init()

err_t usbcpower3_init ( usbcpower3_t * ctx,
usbcpower3_cfg_t * cfg )

USB-C Power 3 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See usbcpower3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_ptn_read_info()

err_t usbcpower3_ptn_read_info ( usbcpower3_t * ctx)

USB-C Power 3 PTN read device information function.

This function reads device identification and revision information from PTN USB PD registers.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Returns error if device ID values do not match expected values.

◆ usbcpower3_ptn_read_reg_block()

err_t usbcpower3_ptn_read_reg_block ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

USB-C Power 3 PTN read register block function.

This function reads multiple bytes from the selected PTN USB PD register over I2C.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the memory location where the read data will be stored.
[in]len: Number of bytes to read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_ptn_read_reg_byte()

err_t usbcpower3_ptn_read_reg_byte ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t * data_out )

USB-C Power 3 PTN read register byte function.

This function reads one byte from the selected PTN USB PD register using the block read function.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the memory location where the read data will be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_ptn_read_reg_word()

err_t usbcpower3_ptn_read_reg_word ( usbcpower3_t * ctx,
uint8_t reg,
uint16_t * data_out )

USB-C Power 3 PTN read register word function.

This function reads a 16-bit word from the selected PTN USB PD register in little-endian format.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to the memory location where the read data word will be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The output pointer is updated only if it is not NULL and the read is successful.

◆ usbcpower3_ptn_write_reg_block()

err_t usbcpower3_ptn_write_reg_block ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

USB-C Power 3 PTN write register block function.

This function writes multiple bytes to the selected PTN USB PD register over I2C.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Pointer to the data buffer to write.
[in]len: Number of bytes to write.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_ptn_write_reg_byte()

err_t usbcpower3_ptn_write_reg_byte ( usbcpower3_t * ctx,
uint8_t reg,
uint8_t data_in )

USB-C Power 3 PTN write register byte function.

This function writes one byte to the selected PTN USB PD register using the block write function.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data byte to write.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_ptn_write_reg_word()

err_t usbcpower3_ptn_write_reg_word ( usbcpower3_t * ctx,
uint8_t reg,
uint16_t data_in )

USB-C Power 3 PTN write register word function.

This function writes a 16-bit word to the selected PTN USB PD register in little-endian format.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: 16-bit data word to write.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ usbcpower3_restart_device()

void usbcpower3_restart_device ( usbcpower3_t * ctx)

USB-C Power 3 device restart function.

This function restarts the device by disabling and re-enabling it.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ usbcpower3_set_high_current()

void usbcpower3_set_high_current ( usbcpower3_t * ctx)

USB-C Power 3 set high current function.

This function sets the current limit pin to a high logic level.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ usbcpower3_set_low_current()

void usbcpower3_set_low_current ( usbcpower3_t * ctx)

USB-C Power 3 set low current function.

This function sets the current limit pin to a low logic level.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ usbcpower3_wait_tcpc_init()

err_t usbcpower3_wait_tcpc_init ( usbcpower3_t * ctx)

USB-C Power 3 wait TCPC init function.

This function waits for TCPC initialization to complete.

Parameters
[in]ctx: Click context object. See usbcpower3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Returns error if initialization times out.